#inputs = gets.chomp.split(' ')
#n,m = inputs.map! {|x| x.to_i}
n,m = 40,100
puts 1
puts "#{n} #{m}"
sizes = Array.new(n,0)
1.upto(n-1) {|i| sizes[i] = i}
sum = 0;
sumSize = sizes.map{|i| sum=sum+i}
edges = Array.new(sumSize.last)
0.upto(sumSize.last-1) {|x| edges[x] = x}
0.upto(10*m){
	a = rand(sumSize.last-1)
	b = rand(sumSize.last-1)
	edges[a],edges[b] = edges[b],edges[a]
}

edges[0...m].each {|x|
	r = sumSize.index{|y| y>x}
	c = x-sumSize[r-1]
	puts "#{c+1} #{r+1}"
}

